package eu.tanov.epf.pv.types.project.ui.pages;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import eu.tanov.epf.pv.types.projectpractice.common.constants.MethodPractice;
import eu.tanov.epf.pv.types.projectpractice.common.constants.ProjectPracticesConstants;

public class ProjectIterationWizardData {
	protected Map<String, List<SelectableMethodPractice>> practices;	
	
	public ProjectIterationWizardData() {
		super();
		Map<String, List<MethodPractice>> methodtopractices = ProjectPracticesConstants.methodToPractices;
		practices = new HashMap<String, List<SelectableMethodPractice>>();
		for (Entry<String, List<MethodPractice>> entry : methodtopractices.entrySet()) {
			practices.put(entry.getKey(),wrapProjectPractices(entry));
		}
	}

	private List<SelectableMethodPractice> wrapProjectPractices(Entry<String, List<MethodPractice>> entry) {
		List<MethodPractice> practicesList = entry.getValue();
		List<SelectableMethodPractice> selMethodPractice = new ArrayList<SelectableMethodPractice>();
		for (MethodPractice methodPractice : practicesList) {
			selMethodPractice.add(new SelectableMethodPractice(methodPractice));
		}
		return selMethodPractice;
	}

	public String[] getProjectMethods() {
		return ProjectPracticesConstants.PROJECT_METHODS;
	}
	
	public List<SelectableMethodPractice> getMethodPractices(String projectMethod) {
		return practices.get(projectMethod);
	}

}
